package com.yanqu.road.server.cmd.zhaoshang;

import com.yanqu.road.pb.zhaoshang.ZhaoShangProto;
import com.yanqu.road.server.CrossBaseServer;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.zhaoshang.ZsMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_ZHAO_SHANG_HELPER_CODE, desc = "招商系统-修复")
public class CrossZhaoShangHelpCodeCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        ZhaoShangProto.ZhaoShangHelpCode msg = ZhaoShangProto.ZhaoShangHelpCode.parseFrom(packet.getBytes());
        String param = msg.getParam();
        if("ConfigReload".equals(param)){
            for(TempMgr mgr : CrossBaseServer.getInstance().getMgrList()){
                if(mgr.getClass().getSimpleName().equals("ZsConfigMgr")){
                    mgr.reload();
                }
            }
        }else {
            ZsMgr.repair(msg.getUserId(), msg.getParam());
        }
    }

    @Override
    public void sendData() {

    }
}
